#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int testGainCard(struct gameState *state, int cards[10]) {
	int i, oldHandCount, player;
	
	for (player = 0; player < state->numPlayers; player ++) {
		printf("\tTesting for player %d:  ", player);
		oldHandCount = state->handCount[player];
		for (i=0;i<30;i++) {
			gainCard(cards[(i%10)],state,2,player);
			if (player == 3) {printf("Gained %d'th card\n\tOldCount: %d, \tNewCount: %d\n",i,oldHandCount,state->handCount[player]);}
			assert(oldHandCount + i + 1 == state->handCount[player]);
		}
		printf("\tSuccessfully gained 30 cards!\n");
	}
	return 0;
}

int main() {
    
    int seed = 1000;
    int numPlayer = 3;
    
	struct gameState G;
	struct gameState *state = &G;
	int k[10] = {adventurer, gardens, embargo, village, minion, mine, cutpurse, 
		   sea_hag, tribute, smithy};

	initializeGame(numPlayer, k, seed, &G);
	printf("Testing gainCard():\n");
	testGainCard(state, k);
	
	printf("   gainCard() Passed all tests!\n");
    return 0;
}

